<template>
	<view>
		<view v-for="item in exams" :key="item.id">
			<uni-card :title="item.name" :extra="item.teacher">
				<view>提交时间：{{item.st}}</view>
				<view v-if="item.ss=='未评阅'">状态：{{item.ss}}</view>
				<view v-if="item.ss=='已评阅'">成绩：{{item.sg}}</view>
			</uni-card>
		</view>
		<view  v-if="exams.length === 0" style="text-align: center; font-size: 48rpx; height: 100vh; line-height: 100vh; color:rgb(127,127,126) ;">
			当前还没参与测试哦！
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				exams:[],
			}
		},
		onLoad() {
			this.user = uni.getStorageSync('user');
			this.loading();
		
		},
		onPullDownRefresh() {
			this.request({
				url: `/studentPaper/page/front/${this.user.id}`
			}).then(res => {
				if (res.code === '0') {
					setTimeout(function() {
						uni.stopPullDownRefresh();
						setTimeout(function() {
							uni.showToast({
								title: '加载成功'
							})
						}, 200);
					}, 800);
				}
				this.exams = res.data;
				console.log(this.exams);
			});
		},
		methods: {
			loading(){
				this.request({
					url: `/studentPaper/page/front/${this.user.id}`
				}).then(res => {
					this.exams = res.data;
					console.log(this.exams);
				});
			},
		}
	}
</script>

<style>

</style>
